public class CountNumberOfPairsWithAbsoluteDifferenceK {
    public int countKDifference(int[] nums, int k) {
        int ans =0;
        if (nums.length==1)
            return ans;
        for (int i=0;i<nums.length;i++){
            for (int j=i+1;j<nums.length;j++){
                if (Math.abs(nums[j]-nums[i])==k)
                    ans++;
            }
        }
        return ans;


    }
}
